package com.probiz.estore.catalog.dao.impl;

import java.util.List;

import com.probiz.estore.catalog.dao.VirtualcatProdRelationDao;
import com.probiz.estore.common.model.catalog.VirtualcatProdRelation;
import com.probiz.estore.core.dao.impl.HibernateGenericDaoImpl;

/**
 * Dao implementation for VirtualcatProdRelation.
*/
public class VirtualcatProdRelationDaoImpl extends HibernateGenericDaoImpl<VirtualcatProdRelation> implements VirtualcatProdRelationDao {
	/*
	 * (non-Javadoc)
	 * @see com.probiz.estore.catalog.dao.VirtualcatProdRelationDao#getVirtualcatProdRelation(java.lang.Integer, java.lang.Integer)
	 */
	public VirtualcatProdRelation getVirtualcatProdRelation(Integer categoryId,Integer productId){
		List<VirtualcatProdRelation> virtualcatProdRelationList = this.findByHql("from VirtualcatProdRelation where virtualCategory.categoryId = ? and product.productId = ?", categoryId,productId);
		if(virtualcatProdRelationList.size() >0){
			return virtualcatProdRelationList.get(0);
		}else{
			return null;
		}
	}
}
